﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;

/// <summary>
/// 安检旅客动画
/// </summary>
public class PassengerAnim : MonoBehaviour
{
    [Header("当前索引")]
    public int currentIndex = 0;
    [Header("旅客类型")]
    public PassengerType passengerType;
    private PassengerManager passengerManager;
    public Animator anim;

    private void Awake()
    {
        passengerManager = PassengerManager.Instance;
        anim = transform.Find("NormalModel").GetComponent<Animator>();
    }

    // 旅客前进
    public void PassengerMove()
    {
        if (currentIndex <= 0)
            return;
        currentIndex -= 1;
        anim.SetBool("Walk", true);
        transform.DOMove(passengerManager.passengerPos[currentIndex].position, 1f).SetEase(Ease.Linear).OnComplete(() =>
        {
            anim.SetBool("Walk", false);
            anim.SetTrigger("Idle");
        });
    }
}
